import { GetterTree } from "vuex";
import { IChatState, friedsLists } from "./types";
import { IState } from "@/store/types";
enum chatGetters {
  GetCurrentChat = "moduleChat/currentChat",
}
interface IContent {
  time: string;
  my?: string;
  he?: string;
}
const getters: GetterTree<IChatState, IState> = {
  //当前聊天用户
  currentChat(state) {
    // return 111
    return state.chatFriendLists.find((item) => item.id == state.currentChatId);
  },
  //当前聊天记录
  currentChatContent(state) {
    return state.currentChatRecords.content;
  },
  trtr(state) {
    return state.currentChatId;
  },
};

export interface IChatGetters {
  moduleChat: {
    currentChat: () => friedsLists;
    trtr: () => void;
    currentChatContent: () => IContent[];
  };
}

export { getters, chatGetters };
